import 'dart:convert';

import 'package:largefriends/entity/json/json_parse_utils.dart';

class LfTokenEntity {
  LfTokenEntity({
    this.accessToken,
    this.expriedIn,
    this.refreshToken,
  });

  factory LfTokenEntity.fromJson(Map<String, dynamic> jsonRes) => LfTokenEntity(
        accessToken: jsonRes.asString('access_token'),
        expriedIn: jsonRes.asInt('expried_in'),
        refreshToken: jsonRes.asString('refresh_token'),
      );

  String? accessToken;
  int? expriedIn;
  String? refreshToken;

  @override
  String toString() {
    return jsonEncode(this);
  }

  Map<String, dynamic> toJson() => <String, dynamic>{
        'access_token': accessToken,
        'expried_in': expriedIn,
        'refresh_token': refreshToken,
      };
}
